package isp.apps.example.shoppingcart.domain.unittest;

import isp.apps.example.shoppingcart.domain.Item;

import java.math.BigDecimal;

import junit.framework.TestCase;

/**
 * The test class ItemTest.
 *
 * @author  (your name)
 * @version (a version number or a date)
 */
public class ItemTest
  extends junit.framework.TestCase
{

  private Item item;

  private String name = "";

  private String sku = "";

  private String description = "";

  private BigDecimal cost = new BigDecimal("0");

  /**
     * Default constructor for test class ItemTest
     */
  public ItemTest()
  {
  }

  /**
     * Sets up the test fixture.
     *
     * Called before every test case method.
     */
  protected void setUp()
  {
    item = new Item();

    item.setName("");
    item.setSku("");
    item.setDescription("");
    item.setCost(new BigDecimal("0"));
    //name = new String("Widget");
    //sku = new String("12345");
    //description = new String("A big widget size 0");
    //cost = new BigDecimal("110");
  }

  /**
     * Tears down the test fixture.
     *
     * Called after every test case method.
     */
  protected void tearDown()
  {
    item = null;
  }
  /*
     * Test set name
     * Test set cost
     * Test set description
     * Test set sku
     * Test get name
     * Test get cost
     * Test get description
     * Test get sku
     */

  public void testGetEmptyName()
  {
    assertEquals(item.getName(), "");
  }

  public void testGetEmptySKU()
  {
    assertEquals(item.getSku(), "");
  }

  public void testGetEmptyDescription()
  {
    assertEquals(item.getDescription(), "");
  }

  public void testGetNullCost()
  {
    assertEquals(item.getCost(), new BigDecimal("0"));
  }

  public void testSetName()
  {
    item.setName("Widget");
    assertEquals(item.getName(), "Widget");
  }

  public void testSetNameTwice()
  {
    item.setName("Widget");
    item.setName("Widget 2");
    assertEquals(item.getName(), "Widget 2");
  }

  public void testSetCost()
  {
    item.setCost(new BigDecimal("100"));
    assertEquals(item.getCost(), new BigDecimal("100"));
  }

  public void testSetDescription()
  {
    item.setDescription("A Realy Big Widget");
    assertEquals(item.getDescription(), "A Realy Big Widget");
  }

  public void testSetSku()
  {
    item.setSku("12345");
    assertEquals(item.getSku(), "12345");
  }

}
